package com.baizhi.serviceplus.impl;

import com.baizhi.entity.Admin;
import com.baizhi.entity.Banner;
import com.baizhi.service.AdminService;
import com.baizhi.service.BannerService;
import com.baizhi.serviceplus.AdminServicePlus;
import com.baizhi.serviceplus.BannerServicePlus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class BannerServicePlusImpl implements BannerServicePlus {
    @Autowired
    private BannerService bannerService;

    @Override
    public Map updateBanner(Banner banner) {
        Map map=new HashMap();
        try {
            bannerService.updateBanner(banner);
            map.put("isOk",true);
        } catch (Exception e) {
            e.printStackTrace();
            map.put("isOk",false);
        }
        return map;
    }

    @Override
    public Map updateBannerStatus(Integer status, Integer id) {
        Map map=new HashMap();
        try {
            bannerService.updateBannerStatus(status,id);
            map.put("isOk",true);
        } catch (Exception e) {
            e.printStackTrace();
            map.put("isOk",false);
        }
        return map;

    }

    @Override
    public Map insertBanner(Banner banner) {
        Map map=new HashMap();
        try {
            bannerService.insertBanner(banner);
            map.put("isOk",true);
        } catch (Exception e) {
            e.printStackTrace();
            map.put("isOk",false);
        }
        return map;
    }

    @Override
    public Map deleteBanner(Integer id) {
        Map map=new HashMap();
        try {
            bannerService.deleteBanner(id);
            map.put("isOk",true);
        } catch (Exception e) {
            e.printStackTrace();
            map.put("isOk",false);
        }
        return map;
    }
}
